#ifndef _MEMARENA_H
#define _MEMARENA_H

class Arena {
	char *base;
	int pointer;
	int size;

	int frozen;
public:
	Arena();
	~Arena();
	void *Alloc(int size) {
		int cur_pointer = pointer;
		pointer += size;
		return base + pointer;
	}

	void FreeAll() {

	}

	void Lock() {
		frozen = pointer;
	}
	void Unlock() {
#ifdef _DEBUG
		memset(base + frozen, 0xCD, pointer - frozen);
#endif
		pointer = frozen;
	}
};

extern Arena arena;


/*
void *operator new(size_t block_size) {
	return arena.Alloc(block_size);
}

void operator delete(void *) {
	// do nothing
}*/

#endif
